package com.lanchetech.user.controller;

import com.lanchetech.bean.response.ResultData;
import com.lanchetech.entity.Category;
import com.lanchetech.entity.ShopCategory;
import com.lanchetech.user.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "类目接口", tags = "类目接口(开放接口)")
@RequestMapping("/api/category")
@RestController
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @ApiOperation("获取前台类目列表")
    @PostMapping("/findAllFrontCategoryList")
    public ResultData<List<Category>> findAllFrontCategoryList(@RequestBody Category category) {
        return categoryService.findAllFrontCategoryList(category);
    }

    @ApiOperation("获取所有商家类目列表")
    @GetMapping("/getAllShopCategoryList")
    public ResultData<List<ShopCategory>> getAllShopCategoryList(@RequestParam("tenantId") Long tenantId) {
        return categoryService.getAllShopCategoryList(tenantId);
    }

    @ApiOperation("后台一级分类")
    @GetMapping("/getLevelTab")
    public ResultData getLevelTab(){
        return categoryService.getLevelTab();
    }
}
